/**
 * Created by nitin on 3/24/14.
 */
function MessageCtrl($scope) {
    $scope.messageData = [
//        {title: "Please be carefull to delete", text: "This function will delete permantly", link: "#",
//            type: 2,
//            yes: function () {
//            },
//            no: function () {
//            }
//        }
    ];

    $scope.messageCreate = function(item){
        if($scope.messageData.length)
            $scope.messageData.splice(0, 1);
        $scope.messageData.push(item);
    };
    $scope.messageYes = function () {
        if ($scope.messageData[this.$index].yes instanceof Function) {
            $scope.messageData[this.$index].yes();
        }
        $scope.messageData.splice(this.$index, 1);
    };
    $scope.messageNo = function () {
        if ($scope.messageData[this.$index].no instanceof Function) {
            $scope.messageData[this.$index].no();
        }
        $scope.messageData.splice(this.$index, 1);
    };
    $scope.messageOK = function () {
        if ($scope.messageData[this.$index].ok instanceof Function) {
            $scope.messageData[this.$index].ok();
        }
        $scope.messageData.splice(this.$index, 1);
    };

}